package gui;


import java.util.List;

import org.joda.time.DateTime;
import org.joda.time.Duration;

import schedule.Event;

import com.thirdnf.ResourceScheduler.Appointment;
import com.thirdnf.ResourceScheduler.Resource;

/**
 * Associe une ressource a un evenement
 * @author Stanislas KOBAK / Celine BARILLERE
 *
 */
class MyAppointment implements Appointment
{
	private Event event;
    private Resource resource;
    
    /**
     * Constructeur
     * @param event Un evenement
     * @param resource Une ressource
     */
    public MyAppointment(Event event, Resource resource)
    {
    	this.event = event;
        this.resource = resource;
    }   

    @Override
    public DateTime getDateTime()
    {
        return event.getStartDate();
    }
    
    public void setDateTime(DateTime date)
    {
        event.setStartDate(date);
    }

    @Override
    public String getTitle()
    {
        return event.getSubject();
    }
    
    public void setTitle(String title)
    {
        event.setSubject(title);
    }

    @Override
    public Resource getResource()
    {
        return resource;
    }
    
    public void setResource(Resource resource)
    {
        this.resource = resource;
    }

    @Override
    public Duration getDuration()
    {
        return Duration.standardMinutes(event.getDuration());
    }
    
    public void setDuration(Duration duration)
    {
        event.setDuration((int) (duration.getStandardSeconds() / 60));
    }
    
    public Event getEvent()
    {
    	return event;
    }
    
    public String getPlace()
    {
        return event.getPlace();
    }
    
    public void setPlace(String place)
    {
        event.setPlace(place);
    }
    
    public List<String> getPersons()
    {
        return event.getPersons();
    }
    
    public void addPerson(String person)
    {
        event.addPerson(person);
    }

}
